<template>
  <div class="app-container">
        <XTablePage
        ref="tablePage"
        :columnsList="columnsList"
        :apiUrl="'/boss/tc-feedback/tc-feedback-list'"
        :method="'post'"
        :formConfig="formConfig"
        :openForm="false"
        :export="false"
        :toolbarConfig="true">
        <template #actions="{ row }">
              <el-link
                  size="medium"
                type="primary"
                icon="el-icon-edit"
                @click="submitForm(row)"
              >编辑</el-link>
                   
      </template>
    </XTablePage>
  </div>
</template>
<script>
import XEUtils from 'xe-utils'

export default {
  name:'feedbackList',
  data() {
    return {
      columnsList: [
      {
         title: "序号",
         type: 'seq', 
         width: 60,
         fixed:'left',
         align:'center',
       },
        {field: 'createName',  title: '姓名'},
        {field: 'phone',  title: '手机号码'},
        {field: 'qaTypeDesc',  title: '类型'},
        {field: 'feedbackContent', title: '反馈内容'},
        {field: 'createTime',  title: '反馈时间'},
        // {title: '操作', width: 120, fixed: "right", slots: {default: 'actions'}}
      ],
      tools: [
          { code: 'btn-download', name: '添加', icon: 'el-icon-download', status: 'primary' }
        ],
      formConfig: {
        titleAlign: 'center',
        items: [
          {
            field: 'phone',
            title: '手机号',
            span: 4,
            itemRender: {name: '$input', defaultValue: '', props: {placeholder: '请输入手机号', clearable: true}}
          },
          {
            field: 'createName',
            title: '姓名',
            span: 4,
            itemRender: {name: '$input', defaultValue: '', props: {placeholder: '请输入姓名', clearable: true}}
          },
          { field: 'qaType', title: '类型', span: 4,     
                itemRender: { 
              name: '$select', 
              props: {placeholder: '类型', clearable: true},
                options: [
                  {label:'课程',value:0},
                  {label:'技术',value:1},
                  {label:'其他',value:2}
                ] 
            } 
           },
          {
            field: 'feedbackContent',
            title: '反馈内容',
            folding: true,
            span: 4,
            itemRender: {name: '$input', defaultValue: '', props: {placeholder: '请输入反馈内容', clearable: true}}
          },

          { field: 'dateRange',folding: true, title: '反馈时间', itemRender:{}, span: 6,   slots:{ default: 'dateRange' }},

          {
            align: 'center', 
            collapseNode:true,
            itemRender: {
              name: '$buttons',
              children: [
                {props: {type: 'submit', icon: 'el-icon-search', content: '查询', status: 'primary'}},
                {props: {type: 'reset', icon: 'el-icon-delete', content: '重置'}}]
            }
          }
        ]
      },
      alarmData: {},
      rules: {},
      dialogVisible: false
    }
  },
  computed: {},
  created() {
  },
  methods: {
    removeRowEvent(row) {
      console.log(row)
      this.alarmData = row;
      this.dialogVisible = true
    },
    formatDate({cellValue}) {
      return XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:ss:mm')
    },
    submitForm(formName) {
      console.log("checkStatus==" + this.alarmData.checkStatus);
      if (this.alarmData.checkStatus == 0) {

        this.$message.error("请选择审核情况");
      } else {
        //接口调用

        checkAlarm({
          alarmNumber: this.alarmData.AlarmGuid,
          checkStatus: this.alarmData.checkStatus,
          checkRemark: this.alarmData.checkRemark,
          alarmTime: this.alarmData.startTime
        }).then((res) => {
          if (res.code == 200) {
            this.$message.success("操作成功");
            this.dialogVisible = false;
          } else {
            this.$message.error(res.message||"操作失败");
          }

        });
      }

    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
}
</script>
<style lang="scss">
.app-container {
  padding: 10px;
  box-sizing: border-box;
  height: calc(100vh - 84px);
  overflow: auto;

  .type--datetime {
    z-index: 99 !important;
  }

  .imageSize {
    width: 300px;
    height: 150px;
  }
}
</style>
